#include "SkinningTechnique.h"
SkinningTechnique::SkinningTechnique(void)
{
}


SkinningTechnique::~SkinningTechnique(void)
{
}
void SkinningTechnique::load()
{
	Technique::load();
	for (unsigned int i = 0 ; i < ARRAY_SIZE_IN_ELEMENTS(m_boneLocation) ; i++) {
		char Name[128];
		memset(Name, 0, sizeof(Name));
		SNPRINTF(Name, sizeof(Name), "gBones[%d]", i);
		m_boneLocation[i] = getUniformLocation(Name);
	}
	m_colorTextureLocation = getUniformLocation("gColorMap");
	m_eyeWorldPosLocation = getUniformLocation("gEyeWorldPos");
}
void SkinningTechnique::setColorTextureUnit(unsigned int TextureUnit)
{
	glUniform1i(m_colorTextureLocation, TextureUnit);
}
void SkinningTechnique::setEyeWorldPos(const Vector3f& EyeWorldPos)
{
	glUniform3f(m_eyeWorldPosLocation, EyeWorldPos.x, EyeWorldPos.y, EyeWorldPos.z);
}
void SkinningTechnique::setBoneTransform(uint Index, const Matrix4f& Transform)
{
	assert(Index < MAX_BONES);
	//Transform.Print();
	glUniformMatrix4fv(m_boneLocation[Index], 1, GL_TRUE, (const GLfloat*)Transform.m);       
}
